#include <auto_ptr.h>

#include <iostream>
#include <string>

using std::string;
using namespace utility;

class Test {
public:
    Test() = default;
    ~Test() { std::cout << "Test is deleted" << std::endl; }

    void setName(const string& name) { _name = name; }
    string getName() const { return _name; }

private:
    string _name;
};

int main() {
    auto p = new Test();
    AutoPtr<Test> ap1(p);
    ap1->setName("Louis");
    std::cout << "Name: " << ap1->getName() << std::endl;

    AutoPtr<Test> ap2(ap1);
    std::cout << "Name: " << ap2->getName() << std::endl;

    return 0;
}